﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ICE.Vacations.Logica.Consultas;
using ICE.Vacations.Entidades;

namespace ICE.Vacations.WebASP
{
    public partial class consultaSA : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                cargarSolicitudes();
            }
            catch
            {
                Response.Redirect("Default.aspx", true);
            }
        }

        public void cargarSolicitudes()
        {
            if (!filtro.Text.Trim().Equals(""))
            {
                if (listaCampos.SelectedValue.Equals("Nombre"))
                    listaSolicitudes.DataSource = QueryManager.consultaSolicitudesXAprobador("", "", filtro.Text);
                else
                    listaSolicitudes.DataSource = QueryManager.consultaSolicitudesXAprobador((string)Session["username"], listaCampos.SelectedValue, filtro.Text);

            }
            else
            {
                listaSolicitudes.DataSource = QueryManager.consultaSolicitudesXAprobador((string)Session["username"]);

            }
            listaSolicitudes.DataBind();
        }

        protected void filtro_TextChanged(object sender, EventArgs e)
        {

        }
    }
}